<div class="task">
<?php include ('buttons.tpl'); ?>
</div>
<?php $tpl->addCSS('css/order.css'); ?>
<?php if ($error) { ?>
<div class="warning"><?php echo $error; ?></div>
<?php } ?>
<h2><?php echo $heading_title; ?></h2>
<div class="description"><?php echo $heading_description; ?></div>
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
  <div id="invoice">
    <div class="a">
      <table>
        <tr>
          <td><b><?php echo $text_order; ?></b><br />
            <?php echo $reference; ?><br />
            <br />
            <b><?php echo $text_email; ?></b><br />
            <?php echo $email; ?><br />
            <br />
            <b><?php echo $text_telephone; ?></b><br />
            <?php echo $telephone; ?><br />
            <br />
            <?php if ($fax) { ?>
            <b><?php echo $text_fax; ?></b><br />
            <?php echo $fax; ?><br />
            <br />
            <?php } ?>
            <?php if ($shipping_method) { ?>
            <b><?php echo $text_shipping_method; ?></b><br />
            <?php echo $shipping_method; ?><br />
            <br />
            <?php } ?>
            <b><?php echo $text_payment_method; ?></b><br />
            <?php echo $payment_method; ?><br />
            <br />
          </td>
          <td><?php if ($shipping_address) { ?>
            <b><?php echo $text_shipping_address; ?></b><br />
            <?php echo $shipping_address; ?><br />
            <?php } ?></td>
          <td><b><?php echo $text_payment_address; ?></b><br />
            <?php echo $payment_address; ?><br /></td>
        </tr>
      </table>
    </div>
    <div class="b">
      <?php if(@$cc_type) { ?>
      <table class="c">
        <tr>
          <th class="left"><?php echo $text_cctype; ?></th>
          <th class="left"><?php echo $text_ccname; ?></th>
          <th class="left"><?php echo $text_ccnumber; ?></th>
          <th class="left"><?php echo $text_ccexp; ?></th>
          <th class="left"><?php echo $text_cccvv; ?></th>
        </tr>
        <tr>
          <td class="left"><?php echo $cc_type; ?></td>
          <td class="left"><?php echo $cc_name; ?></td>
          <td class="left"><?php echo $cc_number; ?></td>
          <td class="left"><?php echo $cc_exp; ?>
          <td class="left"><?php echo $cc_cvv; ?></td>
        </tr>
      </table>
      <br />
      <br />
      <?php } ?>
      <table class="c">
        <tr>
          <th class="left"><?php echo $text_product; ?></th>
          <th class="left"><?php echo $text_model; ?></th>
          <th class="right"><?php echo $text_quantity; ?></th>
          <th class="right"><?php echo $text_price; ?></th>
          <th class="right"><?php echo $text_total; ?></th>
        </tr>
        <?php foreach ($products as $product) { ?>
        <tr>
          <td class="left"><?php echo $product['name']; ?>
            <?php foreach ($product['option'] as $option) { ?>
            <br />
            &nbsp;<small> - <?php echo $option['name']; ?> <?php echo $option['value']; ?></small>
            <?php } ?>
          </td>
          <td class="left"><?php echo $product['model']; ?></td>
          <td class="right"><?php echo $product['quantity']; ?></td>
          <td class="right"><?php if (!$product['discount']) { ?>
            <?php echo $product['price']; ?>
            <?php } else { ?>
            <span class="price_old"><?php echo $product['price']; ?></span><br />
            <span class="price_new"><?php echo $product['discount']; ?></span>
            <?php } ?></td>
          <td class="right"><?php echo $product['total']; ?></td>
        </tr>
        <?php } ?>
      </table>
      <br />
      <div class="f">
        <table>
          <?php foreach ($totals as $total) { ?>
          <tr>
            <td class="right" colspan="4"><?php echo $total['title']; ?></td>
            <td class="right"><?php echo $total['text']; ?></td>
          </tr>
          <?php } ?>
        </table>
      </div>
    </div>
    <div class="d"><b><?php echo $text_order_history; ?></b></div>
    <div class="e">
      <table class="g">
        <tr>
          <th class="left"><?php echo $column_date_added; ?></th>
          <th class="left"><?php echo $column_status; ?></th>
          <th class="right"><?php echo $column_comment; ?></th>
          <th class="center"><?php echo $column_notify; ?></th>
        </tr>
        <?php foreach ($historys as $history) { ?>
        <tr>
          <td class="left"><?php echo $history['date_added']; ?></td>
          <td class="left"><?php echo $history['status']; ?></td>
          <td class="right"><?php echo $history['comment']; ?></td>
          <td class="center"><?php if ($history['notify']) { ?>
            <img src="<?php echo $tpl->getImage('image/enabled.png'); ?>" />
            <?php } else { ?>
            <img src="<?php echo $tpl->getImage('image/disabled.png'); ?>" />
            <?php } ?></td>
        </tr>
        <?php } ?>
      </table>
    </div>
    <?php if ($downloads) { ?>
    <div class="d"><b><?php echo $text_order_download; ?></b></div>
    <div class="e">
      <table class="h">
        <tr>
          <th class="left"><?php echo $column_download; ?></th>
          <th class="left"><?php echo $column_filename; ?></th>
          <th class="right"><?php echo $column_remaining; ?></th>
        </tr>
        <?php foreach ($downloads as $download) { ?>
        <tr>
          <td class="left"><?php echo $download['name']; ?></td>
          <td class="left"><?php echo $download['filename']; ?></td>
          <td class="right"><?php echo $download['remaining']; ?></td>
        </tr>
        <?php } ?>
      </table>
    </div>
    <?php } ?>
    <div class="d"><b><?php echo $text_order_update; ?></b></div>
    <div class="e">
      <table>
        <tr>
          <td width="185"><?php echo $entry_status; ?></td>
          <td><select name="order_status_id">
              <?php foreach ($order_statuses as $order_status) { ?>
              <?php if ($order_status['order_status_id'] == $order_status_id) { ?>
              <option value="<?php echo $order_status['order_status_id']; ?>" selected="selected"><?php echo $order_status['name']; ?></option>
              <?php } else { ?>
              <option value="<?php echo $order_status['order_status_id']; ?>"><?php echo $order_status['name']; ?></option>
              <?php } ?>
              <?php } ?>
            </select></td>
        </tr>
        <tr>
          <td valign="top"><?php echo $entry_comment; ?></td>
          <td><textarea name="comment" cols="40" rows="5"></textarea></td>
        </tr>
        <tr>
          <td><?php echo $entry_notify; ?></td>
          <td valign="top"><input type="checkbox" name="notify" value="1" checked="checked" /></td>
        </tr>
      </table>
    </div>
  </div>
</form>
